import request from "@/utils/request";
import type {
  attrValueListModel,
  categoryIdsModel,
  attrValueModel,
} from "./model/attrModel";
/* 
 GET /admin/product/attrInfoList/{category1Id}/{category2Id}/{category3Id}
 DELETE /admin/product/deleteAttr/{attrId}
 POST /admin/product/saveAttrInfo
*/

//获取
export const getAttrInfoListApi = (params: categoryIdsModel) => {
  return request.get<any, attrValueListModel>(
    `/admin/product/attrInfoList/${params.category1Id}/${params.category2Id}/${params.category3Id}`
  );
};

//删除
export const deleteAttrApi = (attrId: number) => {
  return request.delete(`/admin/product/deleteAttr/${attrId}`);
};

//修改或者新增
export const saveAttrInfoApi = (attrInfoList: attrValueModel) => {
  return request.post("/admin/product/saveAttrInfo", attrInfoList);
};
